package com.personnel.controller;

import com.personnel.service.impl.ImportExcelServiceImpl;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.Map;

/**
 * @Author: YuePeng
 * @Date: 2022/2/17 10:03
 * @Version: 1.0
 */
@RestController
@RequestMapping("/importExcel")
public class ImportExcelController {

    @Resource
    private ImportExcelServiceImpl importExcelServiceImpl;

    /**
     * 员工信息导入
     * @param file
     * @param request
     * @throws IOException
     */
    @Transactional
    @PostMapping("/staff")
    public Map<String, Object> importStaffExcel(MultipartFile file, HttpServletRequest request) throws IOException {
        return importExcelServiceImpl.importStaffExcel(file,request,"uploadExcel");
    }
}
